package com.example.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 1. @ClassDescription: 队列消费者，Direct交换机
 * 2. @author: Z
 * 3. @date: 2023年12月18日 16:26
 */
@Component
@Slf4j
public class DirectListener {

    //存放mq消息
    private static String MQMessage;

    //监听并消费消息
//    @RabbitListener(queues = "direct.queue")
    @RabbitListener(queues = "baking.queue")
    public void listenerDirectQueue(String message){
        this.MQMessage = message;

    }

    public static String getMQMessage() {
        return MQMessage;
    }

    public static void setMQMessage(String MQMessage) {
        DirectListener.MQMessage = MQMessage;
    }
}
